Component({
  behaviors: [require('../../common/share-behavior').default],
  properties: {
    a: Number,
  },
  data: {
    loaded: false
  },
  lifetimes: {},
  methods: {
    handleReady({ detail }) {
      const xrScene = this.scene = detail.value
      console.log('xr-scene', xrScene)
      this.scene.event.add('touchstart', this.handleShare.bind(this))
    },
    handleShare(event) {
      const { clientX, clientY } = event.touches[0]
      const { frameWidth: width, frameHeight: height } = this.scene

      if (clientY / height > 0.7 && clientX / width > 0.7) {
        this.scene.share.captureToFriends()
      }
    }
  }
})
